Developer --> Technical Publications
PATHHardware Documentation > USB Devices > Mac OS USB DDK API Reference


Configuring The Device Interface(s)

Configuring the interface or interfaces of a device is done with the USBConfigureInterface function.

USBConfigureInterface

The USBConfigureInterface function sets the interface on the device, and opens each pipe in the interface. The number of pipes opened is returned. It can also be used to set an alternate interface on the device.

This function does not currently operate as defined above. It does not set the device interface, it will in the future. At this time, the class driver must call the USBDeviceRequest function and make a set_interface device request to set the device interface. The driver can then call USBConfigureInterface to open the pipes in the interface and get the number of pipes. If required, an alternate interface can be specified upon entry in the usbOther field.

OSStatus USBConfigureInterface(USBPB *pb);

Required fields in the USBPB parameter block for the USBConfigureInterface function are

--> pbLength
Length of parameter block
--> pbVersion
Parameter block version number
--> usbCompletion
The completion routine
--> usbRefcon
General-purpose value passed back to the completion routine
--> usbReference
Interface reference obtained from USBNewInterfaceRef
-- usbBuffer
Should be set to 0 (0 returned); reserved in this call
-- usbActCount
Should be set to 0 (0 returned); reserved in this call
-- usbReqCount
Should be set to 0 (0 returned); reserved in this call
--> usbFlags
Should be set to 0
<--> usbOther
--> Alternate interface; <-- Number of pipes in interface

If information about an individual pipe or other element is needed, a device request has to be made.

Configuring an already opened interface is not an error. This sets the alternate and flags settings for the interface. It also invalidates any pipe references you are using.

Errors returned by the USBConfigureInterface function include

kUSBUnknownInterfaceErr -6978 usbReference does not refer to a current interface
kUSBUnknownDeviceErr -6998 usbReference does not refer to a current device
paramErr usbBuffer pointer, usbReqCount, or usbActCount fields are not set to 0
kUSBInternalErr, paramErr -6999 internal configuration descriptor cache corrupted
kUSBNotFound -6987 interface or configuration specified is not in configuration descriptor
kUSBIncorrectTypeErr -6995 interface has control endpoints
kUSBTooManyPipesErr -6996 ran out of internal structures

© 1998 Apple Computer, Inc. – (Last Updated 23 Nov 98)

Previous | Back Up One Level | Next |